package com.heima.model.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.val;

public enum NewsStatusEnum {

    STATUS_NEWS_ZERO(0,"草稿"),
    STATUS_NEWS_ONE(1,"提交（待审核）"),
    STATUS_NEWS_TWO(2,"审核失败"),
    STATUS_NEWS_THREE(3,"人工审核"),
    STATUS_NEWS_FOUR(4,"人工审核通过"),
    STATUS_NEWS_EIGHT(8,"审核通过（待发布）"),
    STATUS_NEWS_NINE(9,"已发布");

    @EnumValue
    @JsonValue
    Integer key;

    String value;

    NewsStatusEnum(Integer key,String value){
        this.key = key;
        this.value = value;
    }

    public Integer getKey() {
        return key;
    }

    public static NewsStatusEnum setNewsStatusEnum(Integer key){
        for (NewsStatusEnum value : NewsStatusEnum.values()) {
            if (value.getKey().equals(key)){
                return value;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }
}
